import 'package:casdon/modules/lifeCircle/data/api/life_subject_list_api.dart';

class LifeSubjectModule {
  final String id;
  final String name; // 板块名称
  final int sort; // 排序
  final String status;

  LifeSubjectModule({
    required this.id,
    required this.name,
    required this.sort,
    required this.status,
  }); // 创建时间

  // 静态方法转换
  static LifeSubjectModule fromApi(ResponseLifeSubjectApi response) {
    return LifeSubjectModule(
      id: response.id,
      name: response.name ?? "",
      sort: response.sort ?? 0,
      status: response.status ?? "0",
    );
  }

  // 批量转换的静态方法
  static List<LifeSubjectModule> listFromApi(
    List<ResponseLifeSubjectApi> items,
  ) {
    return items.map(fromApi).toList();
  }
}
